package com.hd.util.result;

import java.io.Serializable;
import java.util.Map;

import com.googlecode.ehcache.annotations.key.AbstractCacheKeyGenerator;
@SuppressWarnings("unchecked")
public class PageKeyGenerator extends AbstractCacheKeyGenerator<Serializable>{

    @Override
    public Serializable generateKey(Object... data) {
        String result="";
        String page=data[0].toString();
        String pageSize=data[1].toString();
        result+=page+"-"+pageSize;
        Map<String,Object>params=(Map<String,Object>) data[2];
        if(params.size()>0) {
        	//循环map
        	for (Map.Entry<String, Object> entry : params.entrySet()) { 
        		 result+="-"+entry.getValue().toString(); 
        	}
        }
        System.out.println("result="+result);
        return result.hashCode();
    }

}